package com.starwish.starwishblog.web.front;

import com.starwish.starwishblog.result.ResultResponse;
import com.starwish.starwishblog.service.AdviceService;
import com.starwish.starwishblog.service.TagService;
import com.starwish.starwishblog.vo.AdviceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("advice")
public class FAdviceController {

    @Autowired
    AdviceService adviceService;

    @GetMapping("/getAll")
    public ResultResponse<List<AdviceVo>> getAll(){
        ResultResponse<List<AdviceVo>> result = null;
        try {
            List<AdviceVo> adviceList = adviceService.findAllAdvices();
            result = new ResultResponse<>(200,"查询通知成功",adviceList);
        } catch (Exception e) {
            e.printStackTrace();
            result = new ResultResponse<>(305,"查询通知失败");
        }
        return result;
    }
}
